package com.ai.platform.common.page;

public class Pagination implements java.io.Serializable {

    private static final long serialVersionUID = 1L;

    private int pageSize = 10; // 每页默认10条数据
    private int pageNow = 1; // 当前页
    private int totalPages = 0; // 总页数
    private int totalRows = 0; // 总数据数
    private boolean pagination = false;//是否分页
    private Object data;//装载数据

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNow() {
        return pageNow;
    }

    public void setPageNow(int pageNow) {
        this.pageNow = pageNow;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public int getTotalRows() {
        return totalRows;
    }

    public void setTotalRows(int totalRows) {
        this.totalRows = totalRows;
        this.totalPages = (totalRows % pageSize) == 0 ? (totalRows / pageSize) : (totalRows / pageSize + 1);
    }

    public boolean isPagination() {
        return pagination;
    }

    public void setPagination(boolean pagination) {
        this.pagination = pagination;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
